// 云函数入口文件
const cloud = require('wx-server-sdk')

cloud.init({ env: cloud.DYNAMIC_CURRENT_ENV }) // 使用当前云环境

// 云函数入口函数
exports.main = async (event, context) => {
  return cloud.callFunction({//添加参数
    name: "model_parameter",
    data: {
      op: "add",
      g_id: event.good_id,
      key: event.para_name,
      value: event.para_value
    }
  }).then(res => {
    return cloud.callFunction({
      name: "model_parameter",
      data: {
        op: "select",
        key: "_id",
        value: res.result._id
      }
    }).then(res => {
      return res.result.data;
    })
  })
}